package com.gzy.mylog.repository;

import com.gzy.mylog.model.Log;
import com.gzy.mylog.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface LogRepository extends JpaRepository<Log,Long> {

    List<Log> findAllByUid(Long id);

    @Query(value="select * from log where uid=? order by id Asc limit ?,?",nativeQuery=true)
    List<Log> findAllByUidWithPage_Asc(Long uid, Integer offset, Integer size);

    @Query(value="select * from log where uid=? order by id Desc limit ?,?",nativeQuery=true)
    List<Log> findAllByUidWithPage_Desc(Long uid, Integer offset, Integer size);

    int countByUid(Long id);

//    int countByUid(Long id);
}
